#pragma once

#include <memory>

#include "user.h"

enum player_index_e {
    PLAYER_INDEX_SYSTEM = 0,
    PLAYER_INDEX_PLAYER_1 = 1,
    PLAYER_INDEX_PLAYER_2 = 2,
    PLAYER_INDEX_MAX
};

enum game_socres_e {
    GAME_SOCRE_BOMB_OPENED = -10,   /* 玩家点击到地雷时的得分 */
    GAME_SOCRE_NOT_BOMB_OPENED = 1, /* 玩家点开非地雷时的得分 */
};

class player : public std::enable_shared_from_this<player> { 
public:
    player(std::shared_ptr<user> user) : user_(user) {}

    void set_player_index(uint32_t index) { player_index_ = index; }
    uint32_t player_index() const { return player_index_; }
    void add_socre(int score) { socre_ += score; }
    uint32_t score() const { return socre_; }

    std::shared_ptr<user> get_user() { return user_; }

private:
    std::shared_ptr<user> user_;
    uint32_t player_index_;         /* @ref player_index_e */
    uint32_t socre_;
};
